from langchain_mcp_adapters.client import MultiServerMCPClient

from app.config import config

client = MultiServerMCPClient(
    {
        "math": {
            "transport": "stdio",  # Local subprocess communication
            "command": "python",
            # Absolute path to your math_server.py file
            "args": [str(config.root_path / "app/mcp/math_server.py")],
        }
    }
)


async def get_mcp_tools():
    """异步获取MCP工具"""
    return await client.get_tools()
